#ifndef __FS2711_H
#define __FS2711_H

#include "main.h"
#include "stdio.h"
#include "string.h"

typedef struct
{

	uint8_t pdo_num;		  //<! PDO数量
	uint16_t pdo_type[7];	  //<! PDO类型
	uint16_t pdo_max_volt[7]; //<! PDO最大电压
	uint16_t pdo_min_volt[7]; //<! PDO最小电压
	uint16_t pdo_max_curr[7]; //<! PDO最大电流
} FS2711_PDO_List_t;
extern FS2711_PDO_List_t FS2711_PDO_List;

#define PD_TYPE_PPS 1
#define PD_TYPE_FIXED 0

//<! 协议列表
#define FS2711_PROTOCOL_APPLE_2P4A 0
#define FS2711_PROTOCOL_SAMSUNG_2A 1
#define FS2711_PROTOCOL_BC1P2 2
#define FS2711_PROTOCOL_TYPEC 3
#define FS2711_PROTOCOL_QC2 4
#define FS2711_PROTOCOL_QC3 6
#define FS2711_PROTOCOL_AFC 8
#define FS2711_PROTOCOL_FCP 9
#define FS2711_PROTOCOL_SCP 10
#define FS2711_PROTOCOL_HISCP 11
#define FS2711_PROTOCOL_VOOC2 12
#define FS2711_PROTOCOL_SVOOC1 13
#define FS2711_PROTOCOL_VOOC3 14
#define FS2711_PROTOCOL_VOOC4 15
#define FS2711_PROTOCOL_VIVO_5V4A 16
#define FS2711_PROTOCOL_VIVO_10V2P25A 17
#define FS2711_PROTOCOL_VIVO_11V4A 18
#define FS2711_PROTOCOL_MTK 19
#define FS2711_PROTOCOL_PPS 20
#define FS2711_PROTOCOL_PD 21

void FS2711_TEST(uint8_t data);

void FS2711_Scan_Start(void);
void FS2711_System_Reset(void);
void FS2711_Port_Reset(void);
void FS2711_Init(void);
void FS2711_prot_exist(void);
uint16_t get_QC2_volt_flag(void);
uint16_t get_QC3_volt_flag(void);
void FS2711_other_protocol(void);
void FS2711_Deinit(void);
void FS2711_DPDM_Set(void);
void FS2711_DPDM_Reset(void);

void FS2711_Get_State(void);
void FS2711_Get_PD_Information(void);
void FS2711_Open_PPS(uint8_t PDOID, uint16_t start_volt, uint16_t end_volt, uint16_t max_curr);
void FS2711_Open_PD(uint8_t PDOID);
void FS2711_Open_QC2(uint16_t volt);
void FS2711_Open_AFC(uint16_t volt);
void FS2711_Open_FCP(uint16_t volt);
void FS2711_Open_QC3(uint16_t volt);
void FS2711_Open_SCP(uint16_t volt);
void FS2711_Open_HISCP(uint16_t volt);

extern FS2711_PDO_List_t FS2711_PDO_List;
#endif
